package com.iespring.service.app.brand;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iespring.bean.admin.brand.bo.BrandBo;
import com.iespring.bean.admin.brand.po.BrandPo;
import com.iespring.bean.admin.brand.vo.BrandVo;
import com.iespring.bean.common.BasePageInfo;
import com.iespring.bean.common.BaseRespVo;
import com.iespring.bean.common.CommonData;
import com.iespring.mapper.app.BrandWXBackMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author weigwen
 * @Description:
 * @Date 2022/12/31 17:19
 */

@Service
public class BrandWXServiceImpl implements BrandWXService {

    @Autowired
    BrandWXBackMapper brandWXBackMapper;

    @Override
    public CommonData brandList(BasePageInfo basePageInfo) {
        PageHelper.startPage(basePageInfo.getPage(), basePageInfo.getLimit());
        List<BrandVo> brandVos = brandWXBackMapper.selectWXBrand();
        PageInfo<BrandVo> brandVoPageInfo = new PageInfo<>(brandVos);
        return CommonData.data(brandVoPageInfo);
    }

    @Override
    public BaseRespVo brandDetail(BrandBo brandBo) {
        BrandPo brandPo = brandWXBackMapper.selectWXBrandById(brandBo);
        return BaseRespVo.ok(brandPo);
    }

}
